<!doctype html>
<html lang="en" class="fixed">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>财务明细</title>
    <link rel="apple-touch-icon" sizes="120x120" href="favicon/apple-icon-120x120.png">
    <link rel="icon" type="image/png" sizes="192x192" href="favicon/android-icon-192x192.png">
    <link rel="icon" type="image/png" sizes="32x32" href="favicon/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="favicon/favicon-16x16.png">
    <link rel="stylesheet" type="text/css"
          href="<?php xcho(loadSource('/assets/plugins/bootstrap/css/bootstrap.min.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/animate.css/animate.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/font-awesome/css/font-awesome.css')) ?>">
    <link rel="stylesheet"
          href="<?php xcho(loadSource('/assets/plugins/data-table/media/css/dataTables.bootstrap.min.css')) ?>">
    <!--    <link rel="stylesheet" href="-->
    <?php //xcho(loadSource('/assets/plugins/ztree/css/zTreeStyle/zTreeStyle.css')) ?><!--">-->
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/layui/css/layui.css')) ?>" media="all">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/plugins/ztree/css/metroStyle/metroStyle.css')) ?>"
          type="text/css">
    <link rel="stylesheet" href="<?php xcho(loadSource('/app/css/style.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/app/css/app.css')) ?>">
    <link rel="stylesheet" href="<?php xcho(loadSource('/assets/css/new_main.css')) ?>">
    
    <style>
        .layui-form-label {
            width: 110px;
        }

        .pagination {
            margin: 0;
        }

        .content-title {
            /*width: 1200px;*/
            padding: 20px;
            background: #fff;
            margin: 0 auto;
        }

        .content-title .title {
            border-bottom: 1px #ccc solid;
            font-size: 0;
        }

        .content-title .title p {
            width: 60px;
            text-align: center;
            font-size: 14px;
            color: #108EE9;
            display: inline-block;
            position: relative;
        }

        .content-title .title p i {
            width: 70px;
            display: inline-block;
            border-bottom: 2px #108EE9 solid;
            position: absolute;
            bottom: -8px;
            left: 0;
        }

        .content-title .title ul {
            font-size: 0;
            display: inline-block;
            float: right;
            margin-top: -15px;
        }

        .content-title .range {
            margin-top: 10px;
        }

        .content-title .range .layui-form-item label {
            font-size: 12px;
            padding: 6px;
            background: #FBFBFB;
            border: 1px #E8E8E8 solid;
            margin-left: 8px;
            width: initial;
        }

        .content-title .range select {
            width: 80px;
            border: 1px #ccc solid;
            font-size: 10px;
            color: #333;
        }

        .content-title .range select option {
            font-size: 10px;
        }

        .content-title .range input {
            width: 110px;
            height: 34px;
            border: none;
            font-size: 12px;
            border: 1px #ccc solid;
            border-left: none;
            text-indent: 6px;
        }

        .content-title .range div {
            display: inline-block;
            margin-bottom: 0;
        }

        .content-title .canal {
            margin-top: 5px;
        }

        .content-cont {
            /*width: 1200px;*/
            padding: 20px 20px 30px;
            background: #fff;
            margin: 30px auto;
        }

        .content-cont .top_btn .top_more {
            display: inline-block;
            position: relative;
            width: 200px;
        }

        .content-cont .top_btn .top_more button b {
            font-size: 10px;
            color: #fff;
            margin-left: 4px;
        }

        .content-cont .top_btn .top_more ul {
            width: 250px;
            text-align: center;
            padding: 10px;
            background: #fff;
            box-shadow: 0px 0px 5px #ccc;
            position: absolute;
            top: 0;
            left: 102px;
            display: none;
        }

        .content-cont .top_btn .top_more ul li {
            cursor: pointer;
            height: 24px;
            line-height: 24px;
            display: inline-block;

        }

        .content-cont .top_btn .top_btnRight {
            float: right;
        }

        .content-cont .top_pages {
            padding: 3px 15px;
            height: 30px;
            margin-top: 8px;
            font-size: 0;
        }

        .content-cont .top_pages p {
            display: inline-block;
            font-size: 12px;
        }

        .content-cont .top_pages ul {
            font-size: 0;
            display: inline-block;
            float: right;
        }

        .content-cont .top_pages ul li:nth-of-type(1) {
            border: none;
            background: none;
        }

        .content-cont .top_pages ul li:nth-of-type(1):hover {
            background: none;
            color: #999;
        }

        .content-cont .top_pages ul li {
            display: inline-block;
            font-size: 12px;
            background: #fff;
            margin-left: 10px;
            line-height: 24px;
            text-align: center;
            border: 1px #ccc solid;
            border-radius: 6px;
            cursor: pointer;
            color: #999;
        }

        .content-cont .top_pages ul li:last-child {
            border: none;
            background: none;
        }

        .content-cont .top_pages ul li:last-child input {
            width: 50px;
            margin: 0 10px;
            border-radius: 6px;
            border: none;
            border: 1px #ccc solid;
            outline: none;
        }

        .content-cont .top_pages ul li:last-child:hover {
            background: none;
            color: #999;
        }

        .content-cont .top_pages ul li:hover {
            background: #108EE9;
            color: #fff;
        }

        .content-cont .table {
            width: 100%;
            margin-top: 10px;
        }

        .content-cont .table table {
            width: 100%;
        }

        .content-cont .table table thead tr th {
            padding: 10px;
            background: #f2f2f2;
            color: #000;
            text-align: center;
            font-weight: normal;
            border: 1px #e2e2e2 solid;
        }

        .content-cont .table table tbody tr td {
            padding: 8px;
            border: 1px #e2e2e2 solid;
            text-align: center;
        }

        .content-cont .table table tbody tr td:last-child a {
            margin: 0 5px;
            position: relative;
            cursor: pointer;
        }

        .content-cont .table table tbody tr td:last-child a b {
            width: 80px;
            line-height: 24px;
            background: #fff;
            position: absolute;
            bottom: -30px;
            left: -15px;
            font-weight: normal;
            font-size: 10px;
            color: #000;
            border: 1px #ccc solid;
            border-radius: 5px;
            display: none;
            z-index: 10;
        }

        .content-cont .bottom_pages {
            padding: 3px 15px;
            height: 30px;
            margin-top: 8px;
            background: #fff;
            font-size: 0;
        }

        #begin_start_time, #end_start_time {
            height: 34px;
            border: 1px #ccc solid;
            margin-left: 6px;
        }

        .layui-anim > dt {
            cursor: pointer;
        }

        .layui-form-select .layui-select-group dd {
            padding-left: 10px;
        }

        #LAY_layuipro select {
            height: 30px;
            border-radius: 4px;
        }

        .up_area {
            margin-top: 10px;
        }

        .up_area div input {
            width: 100%;
        }

        .layui-input {
            border-radius: 0;
        }
    </style>
</head>

<body><?php include_once TPL_PATH . 'public/nav.phtml'; ?>
<div class="class-box wrap">
    <div class="class-box-head">
        <div class="class-box-title">
            <h3><?php xcho($sname) ?></h3>
            <div class="class-box-tools">
<!--                <a href="javascript:;" class="oshencha">审查</a>-->
                <a href="javascript:;" class="bianji">编辑开票</a>
                <?php if($bujiao=='yes'){ ?>
                    <a href="javascript:;" class="obujiao">补交</a>
                <?php } ?>
                <a href="javascript:;" class="ochedan" actions="cancel" >撤单</a>
                <a href="<?php xcho(url('/student/formal/charges')) ?>?student_id=<?php xcho($student_id) ?>">返回</a>
            </div>
        </div>
    </div>
    <div class="class-box-body">
                
            <div class="content-cont">
                <div>
                    <div class="layui-form table">
                        <span>订单信息（ID <?php xcho($order_id) ?>）</span>
                        <table>
                            <thead>
                            <tr>
                                <th>课程名</th>
                                <th>单小时价格</th>
                                <th>小时数</th>
                                <th>原价</th>
                                <th>类型</th>
                                <th>单小时购买价</th>
                                <th>购买小时</th>
                                <th>购买价</th>
                                <th>操作人</th>
                                <th>操作时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php foreach ($lists as $v) { ?>
                                <tr>
                                    <td><?php xcho($v['course_name']) ?></td>
                                    <td>
                                        <?php if(empty($v['original_duration'])) {?>
                                        <?php }else{ ?>
                                            <?php xcho(number_format(($v['original_price'] / 100) / ($v['original_duration'] / 60),2)) ?>
                                        <?php } ?>
                                    </td>
                                    <td>
                                        <?php if(!empty($v['original_duration'])){ ?>
                                            <?php xcho(round($v['original_duration'] / 60,2)) ?>
                                        <?php } ?>
                                    </td>
                                    <td>
                                        <?php if(!empty($v['original_price'])){ ?>
                                            <?php xcho(round($v['original_price'] / 100,2)) ?>
                                        <?php } ?>
                                    </td>
                                    <td><?php xcho($v['order_type']) ?></td>
                                    <td>
                                        <?php if(empty($v['real_duration'])){ ?>
                                        <?php }else{ ?>
                                            <?php xcho(number_format(($v['real_price'] / 100) / ($v['real_duration'] / 60),2)) ?>
                                        <?php } ?>
                                    </td>
                                    <td>
                                        <?php if(empty($v['real_duration'])) {?>
                                        <?php }else{ ?>
                                            <?php xcho(round($v['real_duration']/60,2)) ?>
                                        <?php } ?>
                                    </td>
                                    <td>
                                        <?php if(empty($v['real_price'])){ ?>
                                        <?php }else{ ?>
                                            <?php xcho(round($v['real_price']/100,2)) ?>
                                        <?php } ?>
                                    </td>
                                    <td><?php xcho($v['creator_id']) ?></td>
                                    <td>
                                        <?php if(empty($v['add_time'])){ ?>
                                        <?php }else{ ?>
                                            <?php xcho(date('Y-m-d H:i:s', $v['add_time'])) ?>
                                        <?php } ?>
                                    </td>
                                                                        <td><a href="javascript:;" class="delorder" order_detail_id="<?php xcho($v['id']) ?>">删除</a></td>

                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                        <span>原价:<?php xcho($priceinfo['count_original']) ?></span>
                        <span>应收:<?php xcho($priceinfo['count_rela_price']) ?></span>
                        <span>优惠:<?php xcho($priceinfo['count_original']-$priceinfo['count_rela_price']) ?></span>
                    </div>
                </div>


                <div class="content-cont">
                    <div>
                        <div class="layui-form table">
                            <span>收费记录</span>
                            <table>
                                <thead>
                                <tr>
                                    <th>实收</th>
                                    <th>收费方式</th>
                                    <th>收费日期</th>
                                    <th>备注</th>
                                    <th>支付凭证</th>
                                    <th>操作人</th>
                                    <th>操作时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php foreach ($chargelists as $vo) { ?>
                                    <tr>
                                        <td>
                                            <?php if(!empty($vo['price'])){ ?>
                                            <?php xcho($vo['price'] / 100) ?>
                                            <?php } ?>
                                        </td>
                                        <td><?php xcho($vo['ptype']) ?></td>
                                        <td>
                                           <?php if(empty($vo['ptime'])){ ?>
                                           <?php }else{ ?>
                                            <?php xcho(date('Y-m-d', $vo['ptime'])) ?>
                                            <?php } ?>
                                        </td>
                                        <td><?php xcho($vo['remark']) ?></td>
                                        <td>
                                            <?php if(empty($vo['evidence_img'])){ ?>
                                                <input type="file" name="stu_import" id="stu_import" pid="<?php xcho($vo['id']) ?>" />
                                               <button class="zhifu" style="color: darkgreen" >上传</button>
                                            <?php }else{ ?>
                                                <input type="file" name="stu_import" id="stu_import" pid="<?php xcho($vo['id']) ?>" />
                                                <button class="zhifu" style="color: darkgreen"  >上传</button>
                                                <a  href="<?php xcho(url('/student/student/chakan'))?>?tt=<?php xcho($vo['evidence_img']) ?>&order_id=<?php xcho($vo['order_id']) ?>&student_id=<?php  xcho($vo['student_id']) ?>" style="color: darkred" >查看</a>
                                            <?php } ?>
                                        </td>
                                        <td><?php xcho($vo['creator_id']) ?></td>
                                        <td>
                                             <?php if(empty($vo['add_time'])){ ?>
                                             <?php }else{ ?>
                                            <?php xcho(date('Y-m-d H:i:s', $vo['add_time'])) ?>
                                            <?php } ?>
                                        </td>
                                        <td>
                                            <?php if($vo['status']!='yes'){ ?>
                                                <a href="javascript:;" pid="<?php xcho($vo['id']) ?>" oid="<?php xcho($vo['order_id']) ?>" class="sureshou">确认收款</a>
                                            <?php }else{ ?>
                                            <a href="javascript:;">已确认</a>
                                            <?php } ?>
                                        </td>
                                    </tr>
                                <?php } ?>
                                </tbody>
                            </table>
                            <span>实收:<?php xcho($priceinfo['count_income']) ?></span>
                            <span>待收:<?php xcho($priceinfo['count_rela_price']-$priceinfo['count_income']) ?></span>
                        </div>
                    </div>
                </div>


                    <div class="content-cont">
                        <div>
                            <div class="layui-form table">
                                <div class="baseMessage">
                                    <div class="basemess">
                                        <h3>开票信息</h3>
                                        <div class="base-cont">
                                            <table>
                                                <tr>
                                                    <td>发票抬头：<span><?php xcho($kaipiaoinfo['receipt_title_type']) ?></span></td>
                                                    <td>抬头信息：<span><?php xcho($kaipiaoinfo['receipt_title']) ?></span></td>
                                                    <td>申请人：<span><?php xcho($kaipiaoinfo['student_id']) ?></span></td>
                                                </tr>
                                                <tr>
                                                    <td>申请时间：<span>
                                                            <?php if(!empty($kaipiaoinfo['add_time'])){ ?>
                                                            <?php xcho(date('Y-m-d',$kaipiaoinfo['add_time'])) ?>
                                                            <?php } ?>
                                                        </span></td>
                                                    <td>修改时间：<span>
                                                            <?php if(!empty($kaipiaoinfo['edit_time'])){ ?>
                                                            <?php xcho(date('Y-m-d H:i:s',$kaipiaoinfo['edit_time'])) ?>
                                                            <?php } ?>
                                                        </span></td>
                                                    <td>备注：<span><?php xcho($kaipiaoinfo['receipt_remark']) ?></span></td>
                                                </tr>
                                                <tr>
                                                    <td>邮寄地址：<span><?php xcho($kaipiaoinfo['mail_address']) ?></span></td>
                                                    <td>邮寄码：<span><?php xcho($kaipiaoinfo['mail_code']) ?></span></td>
                                                </tr>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>



                <div class="content-cont">
                    <div>
                        <div class="layui-form table">
                            <span>审查日志</span>
                            <table>
                                <thead>
                                <tr>
                                    <th>审批人</th>
                                    <th>审批结果</th>
                                    <th>审查备注</th>
                                    <th>审批时间</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php foreach ($checklogs as $lo) { ?>
                                    <tr>
                                        <td><?php xcho($lo['creator_id']) ?></td>
                                        <td><?php xcho($lo['status']) ?></td>
                                        <td><?php xcho($lo['remark']) ?></td>
                                        <td><?php xcho(date('Y-m-d H:i:s',$lo['add_time'])) ?></td>
                                    </tr>
                                <?php } ?>

                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

                </div>
            </div>
    </div>
</div>

            <div class="modal fade" id="check-group" tabindex="-1" role="dialog" aria-labelledby="modal-info-label">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header state modal-info">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                            </button>
                            <h4 class="modal-title" id="modal-info-label"><i class="fa fa-info"></i></h4>
                        </div>
                        <div class="modal-body layui-form" style="min-height: 150px;">
                            <div class="layui-form-item">
                                <label class="layui-form-label">审核状态</label>
                                <div class="layui-input-block">
                                    <select id="check_receipt_status" name="check_receipt_status" lay-verify="required">
                                        <option value=""></option>
                                        <?php foreach ($aChecks as $aTmp) {
                                            if($aTmp['dict_value'] != 'default') {?>
                                                <option value="<?php xcho($aTmp['dict_value']) ?>"><?php xcho($aTmp['cn_name']) ?></option>
                                            <?php } } ?>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">审查备注</label>
                                <div class="layui-input-block">
                                    <textarea id="check_remark" name="check_remark" placeholder="请输入备注" class="layui-textarea"></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <span type="button" class="btn btn-info" id="saveCheck" data-dismiss="modal" url="">确定</span>
                            <span type="button" class="btn btn-default" id="returnCheck" data-dismiss="modal">取消</span>
                        </div>
                    </div>
                </div>
            </div>

            <div class="modal fade" id="kaipiao-group" tabindex="-1" role="dialog" aria-labelledby="modal-info-label">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header state modal-info">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                            </button>
                            <h4 class="modal-title" id="modal-info-label"><i class="fa fa-info"></i></h4>
                        </div>
                        <div class="modal-body layui-form" style="min-height: 150px;">
                            <div class="layui-form-item">
                                <label class="layui-form-label">发票抬头</label>
                                <div class="layui-input-block">
                                    <select id="receipt_title_type_edit" name="receipt_title_type">
                                        <option value=""></option>
                                        <?php foreach ($fapiao as $aTmp) { ?>
                                            <option value="<?php xcho($aTmp['dict_value']) ?>"><?php xcho($aTmp['cn_name']) ?></option>
                                        <?php } ?>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">抬头信息</label>
                                <div class="layui-input-block">
                                    <input type="text" id="receipt_title_edit" name="receipt_title" required
                                           lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                                </div>
                            </div>

                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">添加备注</label>
                                <div class="layui-input-block">
                                    <textarea id="receipt_remark_edit" name="receipt_remark" placeholder="请输入备注" class="layui-textarea"></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <span type="button" class="btn btn-info" id="saveKaipiao" data-dismiss="modal" url="" status="">确定</span>
                            <span type="button" class="btn btn-default" id="returnKaipiao" data-dismiss="modal">取消</span>
                            <span type="button" class="btn btn-default btn-danger" id="cancelKaipiao" style="display: none" data-dismiss="modal" url="" status="">取消开票</span>
                        </div>
                    </div>
                </div>
            </div>


            <div class="modal fade" id="bujiao-group" tabindex="-1" role="dialog" aria-labelledby="modal-info-label">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header state modal-info">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                            </button>
                            <h4 class="modal-title" id="modal-info-label"><i class="fa fa-info"></i></h4>
                        </div>
                        <div class="modal-body layui-form" style="min-height: 150px;">
                            <div class="layui-form-item">
                                <label class="layui-form-label">补交</label>
                                <div class="layui-input-block">
                                    <input type="text" name="price" required  lay-verify="required" placeholder="收费金额" autocomplete="off" class="layui-input">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label" >支付方式</label>
                                <div class="layui-input-block">
                                    <select id="ptype" name="ptype" >
                                        <option value="">请选择</option>
                                        <?php foreach ($paytype as $p) { ?>
                                            <option value="<?php xcho($p['dict_value']) ?>"><?php xcho($p['cn_name']) ?></option>
                                        <?php } ?>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">待收</label>
                                <div class="layui-form-mid layui-word-aux" id="bujiao_val"></div>
                            </div>
                            <div class="layui-form-item">
                                <label class="layui-form-label">收费日期</label>
                                <div class="layui-input-block">
                                    <input type="text" id="ptime" name="ptime" required  lay-verify="required" placeholder="收费金额" autocomplete="off" class="layui-input" value="<?php xcho(date('Y-m-d'),time()) ?>" >
                                </div>
                            </div>

                            <div class="layui-form-item layui-form-text">
                                <label class="layui-form-label">添加备注</label>
                                <div class="layui-input-block">
                                    <textarea id="remark" name="remark" placeholder="请输入备注" class="layui-textarea"></textarea>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <span type="button" class="btn btn-info" id="saveBujiao" data-dismiss="modal">确定</span>
                            <span type="button" class="btn btn-default" id="returnBujiao" data-dismiss="modal">返回</span>
                        </div>
                    </div>
                </div>
            </div>

            <input name="shangchuan" value="<?php xcho($shangchuan) ?>" type="hidden" />
            <input type="hidden" name="order_id"  value="<?php xcho($order_id) ?>"/>
            <input type="hidden" name="delorder"  value="<?php xcho($delorder) ?>"/>
            <input name="savecheck" value="<?php xcho($savecheck) ?>" type="hidden" />
            <input name="getorder" value="<?php xcho($getorder) ?>" type="hidden" />
            <input name="edit" value="<?php xcho($edit) ?>" type="hidden" />
            <input name="savepay" value="<?php xcho($savepay) ?>" type="hidden" />
            <input name="deleteorder" value="<?php xcho($deleteorder) ?>" type="hidden" />
            <input name="sureshoukuan" value="<?php xcho($sureshoukuan) ?>" type="hidden" />
             <input name="return_url" value="<?php xcho($return_url) ?>" type="hidden" />

        <script src="<?php xcho(loadSource('/assets/plugins/jquery/jquery.min.js')) ?>"></script>
        <script src="<?php xcho(loadSource('/assets/plugins/layui/layui.all.js')) ?>" charset="utf-8"></script>
        <script src="<?php xcho(loadSource('/assets/plugins/bootstrap/js/bootstrap.min.js')) ?>"></script>
        <script src="<?php xcho(loadSource('/assets/plugins/data-table/media/js/jquery.dataTables.min.js')) ?>"></script>
        <script src="<?php xcho(loadSource('/assets/plugins/data-table/media/js/dataTables.bootstrap.min.js')) ?>"></script>
        <script src="<?php xcho(loadSource('/assets/plugins/layer-v3.0.3/layer/layer.js')) ?>"></script>
        <script
                src="<?php xcho(loadSource('/assets/plugins/data-table/extensions/Responsive/js/dataTables.responsive.min.js')) ?>"></script>
        <script
                src="<?php xcho(loadSource('/assets/plugins/data-table/extensions/Responsive/js/responsive.bootstrap.min.js')) ?>"></script>
        <script src="<?php xcho(loadSource('/assets/plugins/ztree/js/jquery.ztree.core.js')) ?>"></script>
        <script type="text/javascript"
                src="<?php xcho(loadSource('/assets/plugins/ztree/js/jquery.ztree.excheck.js')) ?>"></script>
        <script type="text/javascript"
                src="<?php xcho(loadSource('/assets/plugins/ztree/js/jquery.ztree.exedit.js')) ?>"></script>
        <script>

            $(function () {
                $(".zhifu").click(function () {
                    var url=$("input[name='shangchuan']").val();
                    var pid=$("#stu_import").attr("pid");
                    var new_url=url+'?id='+pid;
                    var formdata = new FormData();
                    formdata.append("stu_import",document.getElementById('stu_import').files[0]);
                    $.ajax({
                        type: "POST",
                        url: new_url,
                        data:formdata,
                        processData: false,
                        contentType: false,
                        dataType: "json",
                        success: function(resp){
                            if(resp.success == 1){
                             alert(resp.msg);
                                window.location.reload();
                            }else {
                                alert(resp.msg)
                                window.location.reload();
                            }
                        },
                    });
                });
            })
            layui.use(['layer', 'form', 'laydate','element'], function () {
                var layer = layui.layer
                    , form = layui.form
                    ,element = layui.element;
                var laydate = layui.laydate;
                laydate.render({
                    elem:"#ptime"
                });
                form.on("select(date_type)", function (data) {
                    var ddVal = data.value;
                    if (ddVal == "define") {
                        $("#begin_start_time").val("");
                        $("#end_start_time").val("");
                        //执行一个laydate实例
                        laydate.render({
                            elem: '#end_start_time', //指定元素
                            showBottom: false
                        });
                        //执行一个laydate实例
                        laydate.render({
                            elem: '#begin_start_time', //指定元素
                            showBottom: false,
                        });
                    } else {
                        var aDate = getDates(ddVal);
                        $("#begin_start_time").val(aDate['sStartDate']);
                        $("#end_start_time").val(aDate['sEndDate']);
                    }
                })
                form.on('checkbox(allChoose)', function (data) {
                    var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
                    child.each(function (index, item) {
                        item.checked = data.elem.checked;
                    });
                    form.render('checkbox');
                });
                form.on('checkbox(itemChoose)', function (data) {
                    var sib = $(data.elem).parents('table').find('tbody input[type="checkbox"]:checked').length;
                    var total = $(data.elem).parents('table').find('tbody input[type="checkbox"]').length;
                    if (sib == total) {
                        $(data.elem).parents('table').find('thead input[type="checkbox"]').prop("checked", true);
                        form.render();
                    } else {
                        $(data.elem).parents('table').find('thead input[type="checkbox"]').prop("checked", false);
                        form.render();
                    }
                });
                $(".group-picker").focus(function(){
                    $('#info-modal-group').modal({
                        keyboard: false,
                        backdrop:false
                    });
                    $('#info-modal-group').on('shown.bs.modal', function (e) {
                        // 关键代码，如没将modal设置为 block，则$modala_dialog.height() 为零
                        $(this).css('display', 'block');
                        $(this).find('.modal-dialog').css({
                            'margin-top': "100px"
                        });
                    });
                });
                element.on('tab(checkTab)', function(data){
                    $("#receipt_status").val(this.getAttribute('lay-id'));
                    $('#search').click();
                });

                $(".oshencha").on('click',function () {
                    $('#check-group').modal({
                        keyboard: false,
                        backdrop: false
                    });
                    $('#check-group').on('shown.bs.modal', function (e) {
                        $(this).css('display', 'block');
                        $(this).find('.modal-dialog').css({
                            'margin-top': "100px"
                        });
                    });
                });

//
                $(".obujiao").on('click', function () {
                    $('#bujiao-group').modal({
                        keyboard: false,
                        backdrop: false
                    });
                    $('#bujiao-group').on('shown.bs.modal', function (e) {
                        // 关键代码，如没将modal设置为 block，则$modala_dialog.height() 为零
                        $(this).css('display', 'block');
                        $(this).find('.modal-dialog').css({
                            'margin-top': "100px"
                        });
                    });

                    $.ajax({
                        url: $("input[name='getorder']").val(),
                        data: {},
                        type: 'get',
                        dataType: 'json',
                        success: function (data) {
                            if (data.success == 1) {
                                $("#bujiao_val").text((data.data.real_price - data.data.income) / 100);
                            } else {

                            }
                        },
                        complete: function () {
                        },
                        error: function () {

                        }
                    });
                });
                $(".kaipiao").on('click', function () {
                    $('#kaipiao-group').modal({
                        keyboard: false,
                        backdrop: false
                    });
                    $('#kaipiao-group').on('shown.bs.modal', function (e) {
                        // 关键代码，如没将modal设置为 block，则$modala_dialog.height() 为零
                        $(this).css('display', 'block');
                        $(this).find('.modal-dialog').css({
                            'margin-top': "100px"
                        });
                    });
                    $("input[name='order_id']").val($(this).attr('order_id'));
                    $("input[name='save_order_url']").val($(this).attr('url'));

                });
            });

            $("#saveBujiao").on('click', function () {
                var aData = {
                    'order_id': $("input[name='order_id']").val(),
                    'price': ($("input[name='price']").val()) * 100,
                    'ptype': $("#ptype").find("option:selected").attr("value"),
                    'ptime': $("input[name='ptime']").val(),
                    'remark': $("#remark").val(),
                };
                var id=$("input[name='order_id']").val();
                var new_url=$("input[name='savepay']").val()+'?id='+id;
                $.ajax({
                    url: new_url,
                    data: aData,
                    type: 'POST',
                    dataType: 'json',
                    success: function (data) {
                        if (data.success == 1) {
                            layer.msg('操作成功');
                            setTimeout(function(){ window.location.reload(); }, 3000);

                        } else {
                            layer.msg("操作失败");
                        }
                    }
                });
            })


            $("#saveKaipiao").on('click', function () {
                var aData = {
                    'id': $("input[name='order_id']").val(),
                    'receipt_title_type': $("#receipt_title_type_edit").find("option:selected").attr("value"),
                    'receipt_title': $("#receipt_title_edit").val(),
                    'receipt_status': 'audit_submit',
                    'receipt_remark': $("#receipt_remark_edit").val(),
                };
//                alert($("input[name='edit']").val());return false;
                $.ajax({
                    url: $("input[name='edit']").val(),
                    data: aData,
                    type: 'POST',
                    dataType: 'json',
                    success: function (data) {
                        if (data.success == 1) {
                            layer.msg('操作成功');
                            setTimeout(function(){ window.location.reload(); }, 3000);
                        } else {
                            layer.msg("操作失败");
                        }
                    }
                });
            })


            //审查操作saveCheck
            $("#saveCheck").on('click',function () {
                var aData = {
                    'order_id':$("input[name='order_id']").val(),
                    'status':$("#check_receipt_status").find("option:selected").attr("value"),
                    'remark':$("#check_remark").val(),
                };
                $.ajax({
                    url:$("input[name='savecheck']").val(),
                    data:aData,
                    type:'POST',
                    dataType: 'json',
                    success:function (data) {
                        if (data.success == 1) {
                            layer.msg('操作成功');
                            setTimeout(function(){ window.location.reload(); }, 3000);
                            window.location.reload();
                        } else {
                            layer.msg("操作失败");
                        }
                    }
                });
            });


            $(".bianji").on('click',function () {
                $('#kaipiao-group').modal({
                    keyboard: false,
                    backdrop: false
                });
                $('#kaipiao-group').on('shown.bs.modal', function (e) {
                    // 关键代码，如没将modal设置为 block，则$modala_dialog.height() 为零
                    $(this).css('display', 'block');
                    $(this).find('.modal-dialog').css({
                        'margin-top': "100px"
                    });
                });
                $.ajax({
                    url: $("input[name='getorder']").val(),
                    data: {},
                    type: 'get',
                    dataType: 'json',
                    success: function (data) {
                        if (data.success == 1) {
                            $("#receipt_title_type_edit").val(data.data.receipt_title_type);
                            form.render('select');//更新select渲染
                            $("#receipt_title_edit").val(data.data.receipt_title);
                            $("#receipt_remark_edit").val(data.data.receipt_remark);
                        } else {

                        }
                    },
                    complete: function () {
                    },
                    error: function () {

                    }
                });
            });

            //撤单
            $(".ochedan").click(function () {
                var return_url=$("input[name='return_url']").val();
                var delVal = $("input[name='deleteorder']").val(),
                    keyId = $("input[name='order_id']").val(),
                    actions = $(this).attr("actions");
                layer.confirm('确定撤单吗？', {icon: 3, title: '提示'}, function (index) {
                    $.ajax({
                        url: delVal,
                        data: {
                            id: keyId,
                            actions: actions,
                        },
                        type: 'POST',
                        dataType: 'json',
                        success: function (data) {
                            if (data.success == 1) {
                                layer.msg("撤销成功");
                                setTimeout(function(){ window.location.reload(); }, 3000);
                                location.href=return_url;
                            } else {
                                layer.msg("撤销失败");
                            }
                        }
                    })
                });
            });


            //删除课程
            $(".delorder").click(function () {
                var delVal=$("input[name='delorder']").val();
                var order_detail_id = $(this).attr("order_detail_id");
                layer.confirm('确定删除该课程吗？', {icon: 3, title: '提示'}, function (index) {
                    $.ajax({
                        url: delVal,
                        data: {
                            ids: order_detail_id,
                        },
                        type: 'POST',
                        dataType: 'json',
                        success: function (data) {
                            if (data.success == 1) {
                                layer.msg("删除成功");
                                setTimeout(function(){ window.location.reload(); }, 3000);
                                location.href=return_url;
                            } else {
                                layer.msg("删除失败");
                            }
                        }
                    })
                });
            });


             //确认收款
            $(".sureshou").click(function () {
                var order_id = $(this).attr('oid'),
                    url = $("input[name='sureshoukuan']").val();
                var pid=$(this).attr("pid");
                layer.confirm('确定收款吗？', {icon: 3, title: '提示'}, function (index) {
                    $.ajax({
                        url: url,
                        data: {
                            order_id: order_id,
                            pid:pid,
                        },
                        type: 'POST',
                        dataType: 'json',
                        success: function (data) {
                            if (data.success == 1) {
                                layer.msg("确认成功");
                                setTimeout(function(){ window.location.reload(); }, 3000);
                            } else {
                                layer.msg("确认失败");
                            }
                        }
                    })
                });
            })

            //搜索-form表单提交
            $("#search").click(function () {
                $("input[name='now_page']").val($("input:focus").val());
                $("#keciList").submit();
            })
            $("#search").bind('keyup', function (event) {
                if (event.keyCode == "13") {
                    $("input[name='now_page']").val($("input:focus").val());
                    //回车执行查询
                    $('#search').click();
                }
            })
            $("table tr>td>a").hover(function () {
                $(this).find("b").show();
            }, function () {
                $(this).find("b").hide();
            })

            $(".top_more").hover(function () {
                $(this).find("ul").show();
            }, function () {
                $(this).find("ul").hide();
            })
            /*$(".layui-anim>dt").click(function(){
             $(this).nextAll("dd").toggle();
             })*/
            $("#course_name").focus(function () {
                var index = layer.open({
                    type: 2
                    , title: false //不显示标题栏
                    , closeBtn: false
                    , area: 'auto'
                    , shade: 0.8
                    , id: 'LAY_layuipro' //设定一个id，防止重复弹出
                    , btn: ['确定', '取消']
                    , moveType: 1 //拖拽模式，0或者1
                    , content: $(this).attr('url')
                });
                layer.full(index);
            });
            $("#teacher_name").focus(function () {
                var index = layer.open({
                    type: 2
                    , title: false //不显示标题栏
                    , closeBtn: false
                    , area: 'auto'
                    , shade: 0.8
                    , id: 'LAY_layuipro' //设定一个id，防止重复弹出
                    , btn: ['确定', '取消']
                    , moveType: 1 //拖拽模式，0或者1
                    , content: $(this).attr('url')
                });
                layer.full(index);
            });




            var log, className = "dark";
            function beforeDrag(treeId, treeNodes) {
                return false;
            }
            //选中赋值到input中
            function zTreeOnClick(event, treeId, treeNode) {
                // alert(treeNode.tId + "," + treeNode.name);
                $(".group-picker").val(treeNode.name);
                $("#scale_type").val(treeNode.scale_type);
                $("#scale_id").val(treeNode.id);
            }

            var IDMark_Switch = "_switch",
                IDMark_Icon = "_ico",
                IDMark_Span = "_span",
                IDMark_Input = "_input",
                IDMark_Check = "_check",
                IDMark_Edit = "_edit",
                IDMark_Remove = "_remove",
                IDMark_Ul = "_ul",
                IDMark_A = "_a";

            function beforeRename(treeId, treeNode, newName) {
//            if (newName.length == 0) {
//                alert("节点名称不能为空.");
//                var zTree = $.fn.zTree.getZTreeObj("treeDemo");
//                setTimeout(function(){zTree.editName(treeNode)}, 10);
//                return false;
//            }
                editNode(treeNode);
                return true;
            }

            var newCount = 1;
            function add(e) {
                var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
                    isParent = e.data.isParent,
                    nodes = zTree.getSelectedNodes(),
                    treeNode = nodes[0];
                if (treeNode) {
                    treeNode = zTree.addNodes(treeNode, {
                        id: (100 + newCount),
                        pId: treeNode.id,
                        isParent: isParent,
                        name: "new node" + (newCount++)
                    });
                } else {
                    treeNode = zTree.addNodes(null, {
                        id: (100 + newCount),
                        pId: 0,
                        isParent: isParent,
                        name: "new node" + (newCount++)
                    });
                }
                if (treeNode) {
                    zTree.editName(treeNode[0]);
                } else {
                    layer.alert("叶子节点被锁定，无法增加子节点");
                }
            };
            function edit() {
                var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
                    nodes = zTree.getSelectedNodes(),
                    treeNode = nodes[0];
                if (nodes.length == 0) {
                    layer.alert("请先选择一个节点");
                    return;
                }
                zTree.editName(treeNode);
            };
            function remove(e) {
                var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
                    nodes = zTree.getSelectedNodes(),
                    treeNode = nodes[0];
                if (nodes.length == 0) {
                    layer.alert("请先选择一个节点");
                    return;
                }
                var callbackFlag = $("#callbackTrigger").attr("checked");
                zTree.removeNode(treeNode, callbackFlag);
            };
            function setEdit() {
                var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
                    remove = $("#remove").attr("checked"),
                    removeTitle = $.trim($("#removeTitle").get(0).value);
                zTree.setting.edit.showRemoveBtn = remove;
//            zTree.setting.edit.showRenameBtn = rename;
                zTree.setting.edit.removeTitle = removeTitle;
//            zTree.setting.edit.renameTitle = renameTitle;
            }
            function clearChildren(e) {
                var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
                    nodes = zTree.getSelectedNodes(),
                    treeNode = nodes[0];
                if (nodes.length == 0 || !nodes[0].isParent) {
                    alert("请先选择一个父节点");
                    return;
                }
                zTree.removeChildNodes(treeNode);
            };

        </script>
<button id="top" style="height: 50px;width: 50px;"></button></body>
<?php include_once TPL_PATH . 'public/foot_script.phtml'; ?>
</html>
